using UnityEngine;
using System.Collections;

public class SpellsPerDayDisplayTemplate : MonoBehaviour {
	
	public GameObject[] SpellsDisplayByLevel;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public void SetSpellsCountLabel(int level, string count)
	{
		if(SpellsDisplayByLevel.Length > level-1 && level-1 >= 0)
		{
			GameObject spellLevel = SpellsDisplayByLevel[level-1];
			UILabel label;
			
			for(int i = 0; i < spellLevel.transform.GetChildCount(); i++)
			{
				if(spellLevel.transform.GetChild(i).gameObject.name == "PerDayCount")
				{
					label = spellLevel.transform.GetChild(i).GetComponent<UILabel>();
					label.text = count;
					break;
				}
			}
		}	
	}
	
	public void SetSpellsUsedLabel(int level, string count)
	{
		if(SpellsDisplayByLevel.Length > level-1 && level-1 >= 0)
		{
			GameObject spellLevel = SpellsDisplayByLevel[level-1];
			UILabel label;
			
			for(int i = 0; i < spellLevel.transform.GetChildCount(); i++)
			{
				if(spellLevel.transform.GetChild(i).gameObject.name == "UsedCount")
				{
					label = spellLevel.transform.GetChild(i).GetComponent<UILabel>();
					label.text = count;
					break;
				}
			}
		}	
	}
}
